# -*- coding:utf-8 -*-

import pkg_resources

def metaparser_factory(metadefine_language):
	try:
		metaparser_class = pkg_resources.load_entry_point('%smetaparser'%metadefine_language,
			'csv2code.metaparser',
			metadefine_language)
	except pkg_resources.DistributionNotFound:
		return None
        metaparser = metaparser_class()
	return metaparser


def generator_factory(output_language):
	try:
		generator_class = pkg_resources.load_entry_point('%sgenerator'%output_language,
			'csv2code.generator',
			'python')
	except pkg_resources.DistributionNotFound:
		return None
        generator = generator_class()
	return generator


# print metaparser_factory('xml')
# print generator_factory('python')
# 
# 
# print metaparser_factory('xml2')
# print generator_factory('python2')

